/*
 * @Author: 宋绍华
 * @Date: 2024-11-19 10:46:22
 * @LastEditors: 宋绍华
 * @LastEditTime: 2024-12-04 08:40:08
 * @FilePath: \sr_system_manager_ui\src\views\project\utils.ts
 * @Description: 
 */
import { DictionaryListRespVO } from "@/api/project/types"

// 根据字典id 获取字典listDataRespVOList list
export function getDicListById (id: number, list: DictionaryListRespVO[], hasOpt?: boolean) {  
  const _list = list.filter((item: DictionaryListRespVO) => { 
    return item.code === id
  })[0]?.listDataRespVOList || []
  return hasOpt ? _list.map(i => {
    return {
      title: i.dataName,
      value: i.dataId
    }
  }) : _list
}
